# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2004/08/03 10:06:08-06:00 davidm@tiger.hpl.hp.com # Fix pte_modify() bug which allowed mprotect() to change too many bits. # Found by Russell King. # # include/asm-ia64/pgtable.h # 2004/08/03 09:39:16-06:00 davidm@tiger.hpl.hp.com +3 -2 # (_PAGE_CHG_MASK): Change its meaning to list bits that _are_ allowed to # change and list only _PAGE_AR_MASK. # (pte_modify): Only allow changing of bits listed in _PAGE_CHG_MASK. # diff -Nru a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h --- a/include/asm-ia64/pgtable.h 2004-08-03 13:01:54 -07:00 +++ b/include/asm-ia64/pgtable.h 2004-08-03 13:01:54 -07:00 @@ -60,7 +60,8 @@ #define _PAGE_PROTNONE (__IA64_UL(1) << 63) #define _PFN_MASK _PAGE_PPN_MASK -#define _PAGE_CHG_MASK (_PFN_MASK | _PAGE_A | _PAGE_D) +/* Mask of bits which may be changed by pte_modify(): */ +#define _PAGE_CHG_MASK _PAGE_AR_MASK #define _PAGE_SIZE_4K 12 #define _PAGE_SIZE_8K 13 @@ -216,7 +217,7 @@ ({ pte_t __pte; pte_val(__pte) = physpage + pgprot_val(pgprot); __pte; }) #define pte_modify(_pte, newprot) \ - (__pte((pte_val(_pte) & _PAGE_CHG_MASK) | pgprot_val(newprot))) + (__pte((pte_val(_pte) & ~_PAGE_CHG_MASK) | (pgprot_val(newprot) & _PAGE_CHG_MASK))) #define page_pte_prot(page,prot) mk_pte(page, prot) #define page_pte(page) page_pte_prot(page, __pgprot(0))